#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "usbkeyboardthread.h"
#include <QWidget>
#include <QPainter>
#include <QPixmap>
#include <qtimer.h>
#include <QElapsedTimer>
#include <QSet>
#include <QMenuBar>
#include <QSettings>
#include <QFileDialog>
#include <QDateTime>
#include <QRegExpValidator>
#include <QThread>
#include <cmath>
#include <string>
#include <QThread>
#include <QComboBox>
#include <QKeyEvent>
#include <vector>
#include<QMessageBox>
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

//    void initThread();
//    void QTinit();


private slots:
    void onDataReceived(const QByteArray &data);
    void onKBdataReceived(const QByteArray &data);
    void onTPdataReceived(const QByteArray &data);
    void onKTdataReceived(const QByteArray &data);

    void on_connect_keyboard_clicked();

private:
    Ui::MainWindow *ui;
    UsbKeyboardThread *usbKeyboard;
    QThread *keyboardThread;
//    MeasureCurrentThread *msCurrent;
    QThread *currentThread;
    QString folderPath;
    QTimer *timer;
    QTimer *timer2;
    QTimer *timer3;
    QTimer *timertp;
    QTimer *timer4;
    QTimer *timerFlush;//
    QTimer *timer5;


    void initThread();
    void QTinit();
    
    // 初始化所有信号槽连接
    void initConnections();
    
    // 更新连接状态显示
    void updateConnectionStatus(bool isConnected);

};

#endif // MAINWINDOW_H
